package com.desire.test;

import com.wf.captcha.ArithmeticCaptcha;
import com.wf.captcha.ChineseCaptcha;
import com.wf.captcha.GifCaptcha;
import com.wf.captcha.SpecCaptcha;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * @author desire
 */
public class _33_easycaptcha验证码 {
    public static void main(String[] args) throws FileNotFoundException {
        SpecCaptcha captcha = new SpecCaptcha();
        // 获取验证码的字符
        captcha.text();
        // 获取验证码的字符数组
        captcha.textChar();
        captcha.out(new FileOutputStream("C:\\Users\\desire\\Desktop\\javaProject\\01-javaBase\\src\\main\\resources\\captcha.png"));
        // gif 类型
        GifCaptcha gifCaptcha = new GifCaptcha();
        gifCaptcha.setLen(4);
        gifCaptcha.out(new FileOutputStream("C:\\Users\\desire\\Desktop\\javaProject\\01-javaBase\\src\\main\\resources\\captcha.gif"));

        // 中文类型
        ChineseCaptcha chineseCaptcha = new ChineseCaptcha();
        chineseCaptcha.out(new FileOutputStream("C:\\Users\\desire\\Desktop\\javaProject\\01-javaBase\\src\\main\\resources\\captchaC.png"));

        // 算数类型  只能在java1.8 版本中使用
        ArithmeticCaptcha arithmeticCaptcha = new ArithmeticCaptcha();
        arithmeticCaptcha.out(new FileOutputStream("C:\\Users\\desire\\Desktop\\javaProject\\01-javaBase\\src\\main\\resources\\captchaA.png"));
    }
}
